﻿<%@ Page Title="Gallery" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="gallery.aspx.vb" Inherits="photomania._Gallery" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <h2>
        PICTURES CATEGORIES
    </h2>
    <div id="cat">
        <asp:ListView ID="ListView1" runat="server" DataKeyNames="catID" DataSourceID="SqlDataSource3"
            OnSelectedIndexChanging="ListView1_SelectedIndexChanging">
            <AlternatingItemTemplate>
                <li style="">
                    <asp:LinkButton CommandName="Select" ID="catNameLabel" runat="server" Text='<%# Eval("catName") %>' />
                    <br />
                </li>
            </AlternatingItemTemplate>
            <EmptyDataTemplate>
                No data was returned.
            </EmptyDataTemplate>
            <ItemSeparatorTemplate>
                <br />
            </ItemSeparatorTemplate>
            <ItemTemplate>
                <li style="">
                    <asp:LinkButton CommandName="Select" ID="catNameLabel" runat="server" Text='<%# Eval("catName") %>' />
                    <br />
                </li>
            </ItemTemplate>
            <LayoutTemplate>
                <ul id="itemPlaceholderContainer" runat="server" style="">
                    <li runat="server" id="itemPlaceholder" />
                </ul>
                <div style="">
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <li style="">
                    <asp:Label ID="catNameLabel" runat="server" Text='<%# Eval("catName") %>' />
                    <br />
                </li>
            </SelectedItemTemplate>
        </asp:ListView>
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:photodb %>"
            ProviderName="<%$ ConnectionStrings:photodb.ProviderName %>" SelectCommand="SELECT [catName], [catID] FROM [category]">
        </asp:SqlDataSource>
    </div>
    <div id="gal_view">
        <asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource4" DataKeyNames ="pic_id">
            <Columns>
                <asp:BoundField DataField="name" HeaderText="uploaded by" SortExpression="name" />
                <asp:BoundField DataField="caption" HeaderText="caption" SortExpression="caption" />
                <asp:BoundField DataField="catID" HeaderText="category ID" SortExpression="catID" />
                <asp:BoundField DataField="collection" HeaderText="Collection" SortExpression="collection" />
                <%--<asp:ImageField DataImageUrlField="imagelocation" HeaderText="Image">
                    <ControlStyle CssClass="thumbnil" />
                </asp:ImageField>
                <asp:HyperLinkField DataNavigateUrlFields="pic_id" DataNavigateUrlFormatString="details.aspx?id={0}"
                    HeaderText="More Details" Text="More Details" />--%>

                    <asp:TemplateField HeaderText="Image"  HeaderStyle-Font-Underline="true">
                    <ControlStyle Height="100px" Width="100px" />
                    <EditItemTemplate>
                        <asp:TextBox ID="TextBox1" runat="server" Text='<%# Eval("imagelocation") %>'></asp:TextBox>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:HyperLink ID="HyperLink1" NavigateUrl='<%# Eval("pic_id","details.aspx?id={0}") %>'
                            runat="server">
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("imagelocation") %>' CssClass="thumbnil" />
                        </asp:HyperLink>
                    </ItemTemplate>
                </asp:TemplateField>

                <asp:TemplateField>
                    <HeaderStyle HorizontalAlign="Center" Width="100px"></HeaderStyle>
                    <ItemStyle HorizontalAlign="Center" Width="100px"></ItemStyle>
                    <HeaderTemplate>
                        <span style="color: White">Action</span></HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" OnClick="lnkdelete_Click" CommandName="del" CommandArgument='<%# DataBinder.Eval (Container.DataItem, "pic_id") %>'
                            Text="<img border = 0 alt='Delete Entry' src='../pictures/icon_delete.gif'>"
                            Height="16" ToolTip="Delete"></asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:photodb %>"
            ProviderName="<%$ ConnectionStrings:photodb.ProviderName %>"></asp:SqlDataSource>
    </div>
</asp:Content>
